package com.ctshk.common.enums;

import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * @BelongsProject: ctshk-cloud
 * @BelongsPackage: com.ctshk.common.enums
 * @Author: hef
 * @CreateTime: 2021-04-07 17:49
 * @Description: 订单确认成功通知旅客方式
 */
@Getter
@AllArgsConstructor
public enum InformPassengersWay {
    EMAIL(1, "电子邮件"),
    SMS(2, "手机短信"),
    ;
    private Integer type;
    private String name;

    /**
     * 通过type获取实例
     * @param type
     * @return
     */
    public static InformPassengersWay getInstance(Integer type){
        InformPassengersWay informPassengersWay = Arrays.stream(InformPassengersWay.values())
                .filter(enums -> enums.getType().equals(type)).findFirst().orElse(null);
        return informPassengersWay;
    }
}
